/*************************************************************************
	> File Name: oj-189_binarysearch.c
	> Author: Wang Bo
	> Mail: 1276106221@qq.com
	> Created Time: 2020年10月26日 星期一 03时01分53秒
 ************************************************************************/

#include <stdio.h>
#include <stdlib.h>

int bs(int *a, int len, int x) {
    int l = 1, r = len, mid;
    while (l <= r) {
        mid = (l + r) / 2;
        if (a[mid] == x) return mid;
        if (a[mid] < x) l = mid + 1;
        if (a[mid] > x) r = mid - 1;
    }
    return 0;
}

int main() {
    int n, k, x, max = 0, min = 1000001;
    scanf("%d%d", &n, &k);
    int *arr = (int *)malloc(sizeof(int) * (n + 5));
    int *chk = (int *)malloc(sizeof(int) * (k + 5));
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &arr[i]);
        if (arr[i] > max) max = arr[i];
        if (arr[i] < min) min = arr[i];
    }
    for (int i = 0; i < k; ++i) {
        scanf("%d", &chk[i]);
    }
    printf("max:%d\nmin:%d\n", max, min);
    for (int i = 0; i < k; ++i) {
        i && printf(" ");
        if (chk[i] > max || chk[i] < min) printf("0");
        printf("%d", bs(arr, n, chk[i]));
    }
    free(arr);
    free(chk);
    return 0;
}
